{% extends 'custom_admin/base.html' %}

{% block title %}文章审核{% endblock %}

{% block content %}
<div class="page-heading">
    <h4><i class="fas fa-check-circle me-2"></i>文章审核</h4>
</div>

<!-- 待初审文章 -->
<div class="card mb-4">
    <div class="card-header">
        <h5><i class="fas fa-clock me-2"></i>待初审文章</h5>
    </div>
    <div class="card-body">
        {% if pending_articles %}
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>标题</th>
                        <th>作者</th>
                        <th>提交时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for article in pending_articles %}
                    <tr>
                        <td>{{ article.title }}</td>
                        <td>{{ article.author.username }}</td>
                        <td>{{ article.submitted_at|date:"Y-m-d H:i" }}</td>
                        <td>
                            <a href="{% url 'custom_admin:article_first_review' article.pk %}" class="btn btn-primary btn-sm">
                                <i class="fas fa-search me-1"></i>初审
                            </a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <p class="text-center text-muted">暂无待初审文章。</p>
        {% endif %}
    </div>
</div>

<!-- 待终审文章 -->
<div class="card">
    <div class="card-header">
        <h5><i class="fas fa-user-check me-2"></i>待终审文章</h5>
    </div>
    <div class="card-body">
        {% if first_approved_articles %}
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>标题</th>
                        <th>作者</th>
                        <th>初审时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for article in first_approved_articles %}
                    <tr>
                        <td>{{ article.title }}</td>
                        <td>{{ article.author.username }}</td>
                        <td>{{ article.first_reviewed_at|date:"Y-m-d H:i" }}</td>
                        <td>
                            <a href="{% url 'custom_admin:article_final_review' article.pk %}" class="btn btn-success btn-sm">
                                <i class="fas fa-check-double me-1"></i>终审
                            </a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <p class="text-center text-muted">暂无待终审文章。</p>
        {% endif %}
    </div>
</div>
{% endblock %}